﻿(function (wtm) {
    wtm.TriggerSearch = function (index) {
        var $tab = $('#LAY_app_body .layadmin-tabsbody-item.layui-show').first();
        var tables = $tab.find('table[id]');
        var searchBtns = $tab.find('form a[IsSearchButton]');

        if (searchBtns.length > index) {
            var sb = $('#' + searchBtns[index].id);
            var form = sb.parents("form");
            if (form.attr("oldpost") == 'True') {
                sb.trigger("click");
            }
            else {
                sb.trigger("myclick", true);
            }
        }
        else {
            if (tables.length > index) {
                layui.table.reload(tables[index].id);
            }
        }
    };
})(wtm);